//
//  NYGradeViewCell.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2018/1/9.
//  Copyright © 2018年 niuwaketang. All rights reserved.
//

#import "NYGradeViewCell.h"

#import "NYGradeModel.h"

@interface NYGradeViewCell ()

@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation NYGradeViewCell

//MARK :Nimbus
- (BOOL)shouldUpdateCellWithObject:(NYGradeModel *)object {
        
    if (![object isKindOfClass:[NYGradeModel class]]) {
            return false;
    }
    [self updateContentWithModel:object];
    return true;
}
+ (CGFloat)heightForObject:(id)object identifier:(NSString *)identifier atIndexPath:(NSIndexPath *)indexPath tableView:(UITableView *)tableView {
        
    return 50.f;
}
- (void)setupView {
    [super setupView];
    //布局
    self.accessoryType = UITableViewCellAccessoryNone;

    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.bottom.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(15);
        make.right.equalTo(self.contentView).offset(-15);
    }];
}
- (void)updateContent {
    [super updateContent];
}
#pragma mark - Target Methods

#pragma mark - Public Methods

#pragma mark - Private Method
- (void)updateContentWithModel:(NYGradeModel *)model {
    
    self.titleLabel.text = model.gname;
}
#pragma mark - External Delegate

#pragma mark - Setter Getter Methods
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        _titleLabel.font = UIFontMake(15.f);
        _titleLabel.textColor = UIColorMakeWithHex(@"#333333");
    }
    return _titleLabel;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    self.contentView.backgroundColor = selected ? [UIColor whiteColor] : UIColorMakeWithHex(@"#F5F5F5");
    self.titleLabel.textColor = selected ? UIColorMakeWithHex(@"#3696FF") : UIColorMakeWithHex(@"#333333");
}

@end
